﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace _2DGame
{
    class Obstacle
    {

        Vector2 Position;
        Texture2D Texture;
        int StageWidth, StageHeight;

        //Constructor - Fredrik & Mats
        public Obstacle(Texture2D texture, Vector2 position, int stageWidth, int stageHeight)
        {
            Texture = texture;
            Position = position;
            StageWidth = stageWidth;
            StageHeight = stageHeight;
        }

        //Updates speed and position of obstacle - Fredrik & Mats
        public void MoveObstacle(GameTime gameTime, int speed)
        {
            Position.X -= LevelController.SpeedRunner();

            if (Position.X < StageWidth - (StageWidth + Texture.Width + 10))
            {
                Position.X = StageWidth + 10;
            }
        }

        //Updates - Fredrik & Mats
        public void Update(GameTime gameTime, int speed)
        {
        }

        //Texture properties
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(Texture, Position, Color.White);
            spriteBatch.End();
        }
    }
}
